package com.allen.controller;

import com.allen.bean.Like;
import com.allen.bean.Result;
import com.allen.service.LikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: allen
 * @Data: 2021.06.23.17:34
 **/
@RestController    //相当于@Controller+@RequestBody
@RequestMapping("/like")
@CrossOrigin(origins ="*")
public class LikeController {

    @Autowired
    private LikeService likeService;        //注入service层

    @RequestMapping("hello")
    public String hello(){
        return "hello";
    }
    /**
     *查询是否点赞
     */
    @RequestMapping("sellike")
    public Result sellike(Like like){
        System.out.println("成功进入like控制器");
        return  likeService.sel(like);
    }

    /**
     * 点赞数量加一
     */
    @RequestMapping("addlike")
    public Result addlike(Like like){
        System.out.println("进入/like/addlike");
        return likeService.sel(like);
    }
}
